package com.example.demo.controller;

import com.example.demo.model.service.MarkService;
import com.example.demo.model.valueObject.Mark;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class AllUsersMarks {
    private final static String AllUsersMarksPage = "AllUsersMarks";
    private final static String AllUsersMarksUrl = "/admin/AllUsersMarks";
    @Autowired
    private MarkService markService;
    @GetMapping(AllUsersMarksUrl)
    public String getAllUsersMarksPage(HttpServletRequest request)
    {
        List<Mark>marks = markService.retrieveAllMarks();
        request.setAttribute("marks",marks);
        return AllUsersMarksPage;
    }
}
